const state = {
    items: [],
    active: ''
};

const getters = {
};

const mutations = {
    addTabs(state, data) {
        state.items.push(data);
    },
    deleteTabs(state, routePath) {
        let index = 0;

        for (let item of state.items) {
            if (item.path === routePath) {
                break;
            }

            index++;
        }

        state.items.splice(index, 1);
    },
    setActivePath(state, routePath) {
        state.active = routePath;
    }
};

const actions = {
};

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions
};
